# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-asyncpg
pkgver=0.29.0
pkgrel=1
pkgdesc="A fast PostgreSQL Database Client Library for Python/asyncio"
url="https://github.com/MagicStack/asyncpg"
arch="all"
license="Apache-2.0"
depends="py3-async-timeout"
makedepends="
	cython
	py3-build
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
subpackages="$pkgname-doc $pkgname-pyc"
checkdepends="
	postgresql
	postgresql-contrib
	py3-pytest
	py3-pytest-runner
	py3-uvloop
	"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/a/asyncpg/asyncpg-$pkgver.tar.gz"
builddir="$srcdir/asyncpg-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages testenv
	testenv/bin/python3 -m installer dist/*.whl

	mv asyncpg asyncpg-off

	testenv/bin/python3 -m pytest
}

package() {
	python -m installer -d "$pkgdir" dist/*.whl

	install -vDm644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
}

sha512sums="
5db979496323fcf4068d5de111b52f2ae1ad9efe68f80c28e6303ad936eb051d1792409f1e31fb86dc35caad5ef9b92c40e4f6dcbcccc3907ab2247f61db5504  py3-asyncpg-0.29.0.tar.gz
"
